<?php
   class Shipajax extends MY_Controller{
	   public function __construct(){
		   parent::__construct();
		   $this->load->helper("url");
		   $this->load->model("model_ship");
	   }
	   public function index(){
		   $tour 	= $this->input->post("tour");
		   $adults 	= $this->input->post("adults");
		   $child 	= $this->input->post("child");
		   $infants = $this->input->post("infants");
		   $start   = strtotime($this->input->post("start"));
		   $ship_id = $this->input->post("ship");
		   $data    = $this->model_ship->getrooms_ajax($ship_id,$start);
		   echo '<table width="737" border="0" cellspacing="0" cellpadding="0">
					<tr>
					 	<td width="81" class="title">ROOM TYPE</td>
						<td width="90" class="title">PICTURE</td>
						<td width="85" class="title">NUMBER OF ROOM</td>
						<td width="83" class="title">ADULTS</td>
						<td width="83" class="title">CHILDREN</td>
						<td width="82" class="title">INFANTS</td>
						<td width="95" class="title">PROMOTION</td>
						<td width="89" class="title">TOTAL</td>
						<td width="49" class="title">BOOK</td>
					</tr>';
			if($data != NULL){
				$stt = 0;
				foreach($data as $items){
					$stt++;
					echo "<tr>";	
						echo " <td class='yellow'><span class='room_title$stt'>".$items['room_title']."</span><span class='idroom$stt' style='display:none'>".$items['room_id']."</span></td>";
						echo " <td><img src='".base_url()."uploads/sheep/rooms/thumb/".$items['room_image']."' /><span id='img_aj$stt' style='display:none'>".$items['room_image']."</span>	</td>";
						echo " <td>";
							echo "<select name='numroom$stt' id='numroom$stt' onchange='price($stt)'>
                                	<option value='1'>1</option>
                                	<option value='2'>2</option>
                                	<option value='3'>3</option>
				            	  </select>";
						echo "</td>";
						echo " <td>";
							echo "<select name='adults$stt' id='adults$stt' onchange='price($stt)'>
                                	<option value='1'>1</option>
                                	<option value='2'>2</option>
                                	<option value='3'>3</option>
									<option value='4'>4</option>
									<option value='5'>5</option>
									<option value='6'>6</option>
				            	  </select>";
							echo "<a id='price_single$stt' name='".$items['room_price_single']."' style='display:none'></a>";
							echo "<a id='price_double$stt' name='".$items['room_price_double']."' style='display:none'></a>";
							echo "<a id='price_promo_1sing$stt' name='".$items['room_promo_single1']."' style='display:none'></a>";
							echo "<a id='price_promo_2sing$stt' name='".$items['room_promo_single2']."' style='display:none'></a>";
							echo "<a id='price_promo_1double$stt' name='".$items['room_promo_double1']."' style='display:none'></a>";
							echo "<a id='price_promo_2double$stt' name='".$items['room_promo_double2']."' style='display:none'></a>";
						echo "</td>";
						echo " <td>";
							echo "<select name='child$stt' id='child$stt' onchange='price($stt)'>
                                	<option value='0'>0</option>
                                	<option value='1'>1</option>
                                	<option value='2'>2</option>
                                	<option value='3'>3</option>
				            	  </select>";
							echo "<a id='price_child$stt' name='".$items['room_price_child']."' style='display:none'></a>";
						echo "</td>";
						echo " <td>";
							echo "<select name='infant$stt' id='infant$stt'>
                                	<option value='0'>0</option>
                                	<option value='1'>1</option>
                                	<option value='2'>2</option>
                                	<option value='3'>3</option>
				            	  </select>";
							echo "<a id='price_infant$stt' name='".$items['room_price_infant']."' style='display:none'></a>";
						echo "</td>";
						echo "<td><span id='line$stt'>$".$items['room_promo_single1']."</span><p id='p$stt' style='color:#F90;font-size:13px;font-weight:bold;margin-top:3px;'>$".$items['room_promo_single2']."</p></td>";
						echo "<td><span id='totalp$stt'>$".$items['room_price_single']."</span></td>";
						echo "<td><p style='margin-bottom:5px;'><span class='okie$stt'></span></p><a href='#' id='".$stt."' class='arate'>Select</a></td>";
					echo "</tr>";
				}
				echo "<tr>";
					echo '<td height="40" colspan="9">';
					echo "<a href='".base_url()."your-cart#yourcart'><img src='".base_url()."public/images/book_rate.png' alt='Book now' title='Book now' align='right' /></a>";
					echo "</td>";
				echo "</tr>";
			}else{
				echo "<tr><td colspan='9' height='100'>No room available</td></tr>";
			}
			echo "</table>";
	   }
   }
